home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-07 | 2.2 KB | 91 lines | [TEXT/MPS ] |
- (*
- CTBConfiguration([type]) -- Return the current configuration string for the type of tool
- indicated ("connection" (default), "terminal", or "file transfer").
-
- To compile and link this file using Macintosh Programmer's Workshop,
-
- pascal -w CTBConfiguration.p
- link -m ENTRYPOINT -o HyperCommands -rt XFCN=2754 -sn Main=CTBConfiguration ∂
- CTBConfiguration.p.o "{MPW}"Libraries:interface.o "{MPW}"Libraries:Libraries:HyperXLib.o
-
- © Copyright 1990 by Apple Computer, Inc.
-
- Initial coding 2/90 by Harry R. Chesley.
- *)
-
- {$R-}
-
- {$S CTBConfiguration } { Segment name must be the same as the command name. }
-
- unit DummyUnit;
-
- interface
-
- uses MemTypes, QuickDraw, OSIntf, ToolIntf, CTBUtils, FTIntf, CMIntf, TMIntf, CRMIntf, HyperXCmd;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- implementation
-
- procedure CTBConfiguration(paramPtr: XCmdPtr); forward;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- begin
- CTBConfiguration(paramPtr);
- end;
-
- procedure CTBConfiguration(paramPtr: XCmdPtr);
-
- {$I CTBUtil.inc}
-
- var i: integer;
- tt: ToolType;
- p, p2: Ptr;
- h: Handle;
- l: longInt;
- err: OSErr;
-
- procedure Fail(errMsg: Str255); { set theResult and quit }
- begin
- paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
- exit(CTBConfiguration);
- end;
-
- begin
- { Check the parameter count. }
- i := paramPtr^.paramCount;
- if i > 1 then Fail('Invalid parameter count');
-
- { Figure out which tool we're getting the configuration for. }
- if i = 0 then tt := connectionTool
- else tt := GetToolTypeParm(1);
-
- { Make sure the Comm Toolbox is here. }
- CTBReady;
-
- { Get the configuration string. }
- p := nil;
- case tt of
- connectionTool: if Globals^^.connHand <> nil then p := CMGetConfig(Globals^^.connHand);
- terminalTool: if Globals^^.termHand <> nil then p := TMGetConfig(Globals^^.termHand);
- fileTransferTool: if Globals^^.FTHand <> nil then p := FTGetConfig(Globals^^.FTHand);
- end;
- { Copy it into a handle and return it. }
- if p <> nil then
- begin
- p2 := p; l := 1;
- while p2^ <> 0 do
- begin
- p2 := Ptr(ord4(p2)+1);
- l := l+1;
- end;
- err := PtrToHand(p,h,l);
- DisposPtr(p);
- FailOSErr(err);
- paramPtr^.returnValue := h;
- end;
- end;
-
- end.
-